<?php
class addAction extends rareAction{
    public function execute(){}
	public function executePost(){
		$menu = $this->getPostParam('menu',array());
		if(!empty($menu)){
			$menuDao = new DaoMenu();
			$menu['title'] = trim($menu['title']);
			$id = $menuDao->insert($menu);

			$parent = $menuDao->getOne('id='.$menu['parentID']);
			$path = empty($parent)?"0,$id":$parent['path'].",$id";
			$menuDao->update("id='$id'",array('path'=>$path));
			jsonReturn(1,'ok');
		}
		jsonReturn(0,'添加失败');
	}
}
?>
